<?php

interface Mapper extends SimpleIterator
{
    /**
     * Get the complete or rest data
     * @return array of data
     */
    public function getAll();

    /**
     * Inform the Mapper about changes in the data array
     * The array is recognized by it's id
     * @param array $data
     */
    public function inform(array $data);
}

/**
 * One function iterator, untyped php only.
 * Does not support false values. Has to be tested strict !== false in some cases
 * while ($o = $this->get($id)) {
 *     $ret[$id] = $o;
 * }
 */
interface SimpleIterator
{
    /**
     * Iterate through the data return one per one
     * @param reference int $id ID
     * @return obj/array or bool false if there is nothing to get
     */
    public function get(&$id = NULL);
}